<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->id();
            $table->string('title', 200)->comment('标题');
            $table->string('cover_url', 200)->nullable()->comment('封面');
            $table->tinyInteger('type')->comment('');
            $table->string('source')->comment('来源')->nullable();
            $table->text('content');
            $table->integer('read_num')->default(0);
            $table->integer('push_time');
            $table->string('download_path')->nullable();
            $table->tinyInteger('identity_visibility')->default(0)->comment('身份可见性');
            $table->timestamps();
            $table->softDeletes();
            $table->index('type');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}
